package com.example.aop.proxy.staticc;

import com.example.aop.proxy.HouseSubject;
import com.example.aop.proxy.RealHouseSubject;

public class HouseProxy implements HouseSubject {
    // 静态代理
    private RealHouseSubject realHouseSubject;

    public HouseProxy(RealHouseSubject realHouseSubject) {
        this.realHouseSubject = realHouseSubject;
    }

    @Override
    public void rentHouse() {
        System.out.println("我是代理，开始代理");
        realHouseSubject.rentHouse();
        System.out.println("我是代理，结束代理");
    }

    @Override
    public void saleHouse() {
        System.out.println("我是代理，开始代理");
        realHouseSubject.saleHouse();
        System.out.println("我是代理，结束代理");
    }
}
